/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ongmanager.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author wbettencourt
 */
@Entity
@Table(name = "redsocial")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Redsocial.findAll", query = "SELECT r FROM Redsocial r"),
    @NamedQuery(name = "Redsocial.findByIdRedSocial", query = "SELECT r FROM Redsocial r WHERE r.idRedSocial = :idRedSocial"),
    @NamedQuery(name = "Redsocial.findByRedSocial", query = "SELECT r FROM Redsocial r WHERE r.redSocial = :redSocial"),
    @NamedQuery(name = "Redsocial.findBySeudonimo", query = "SELECT r FROM Redsocial r WHERE r.seudonimo = :seudonimo"),
    @NamedQuery(name = "Redsocial.findByCreatedAt", query = "SELECT r FROM Redsocial r WHERE r.createdAt = :createdAt")})
public class Redsocial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IdRedSocial")
    private Integer idRedSocial;
    @Basic(optional = false)
    @Column(name = "RedSocial")
    private String redSocial;
    @Basic(optional = false)
    @Column(name = "Seudonimo")
    private String seudonimo;
    @Basic(optional = false)
    @Column(name = "created_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdAt;
    @JoinColumn(name = "IdContacto", referencedColumnName = "IdContacto")
    @ManyToOne(optional = false)
    private Contacto idContacto;

    public Redsocial() {
    }

    public Redsocial(Integer idRedSocial) {
        this.idRedSocial = idRedSocial;
    }

    public Redsocial(Integer idRedSocial, String redSocial, String seudonimo, Date createdAt) {
        this.idRedSocial = idRedSocial;
        this.redSocial = redSocial;
        this.seudonimo = seudonimo;
        this.createdAt = createdAt;
    }

    public Integer getIdRedSocial() {
        return idRedSocial;
    }

    public void setIdRedSocial(Integer idRedSocial) {
        this.idRedSocial = idRedSocial;
    }

    public String getRedSocial() {
        return redSocial;
    }

    public void setRedSocial(String redSocial) {
        this.redSocial = redSocial;
    }

    public String getSeudonimo() {
        return seudonimo;
    }

    public void setSeudonimo(String seudonimo) {
        this.seudonimo = seudonimo;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Contacto getIdContacto() {
        return idContacto;
    }

    public void setIdContacto(Contacto idContacto) {
        this.idContacto = idContacto;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRedSocial != null ? idRedSocial.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Redsocial)) {
            return false;
        }
        Redsocial other = (Redsocial) object;
        if ((this.idRedSocial == null && other.idRedSocial != null) || (this.idRedSocial != null && !this.idRedSocial.equals(other.idRedSocial))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return redSocial +": " + seudonimo;
    }
    
}
